package com.wmh.baseservice.common.websocket.config;

import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.web.servlet.ServletContextInitializer;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.util.WebAppRootListener;

import javax.servlet.ServletContext;
import javax.servlet.ServletException;

@Configuration
public class LongConnectionConfig implements ServletContextInitializer {
    @Override
    public void onStartup(ServletContext servletContext) throws ServletException {
        System.out.println("org.apache.tomcat.websocket.textBufferSize");
        servletContext.addListener(WebAppRootListener.class);
        //接收的消息在5mb以内
        servletContext.setInitParameter("org.apache.tomcat.websocket.textBufferSize","5242880");
        servletContext.setInitParameter("org.apache.tomcat.websocket.binaryBufferSize","5242880");

    }
}
